package com.herench.bs.handler;

import com.herench.bs.agent.IPersonAgent;
import com.herench.bs.annotation.Handler;
import com.herench.bs.support.AbstractMessageHandler;
import com.herench.bs.support.RequestMessage;
import com.herench.bs.support.ResponseMessage;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Created by ThinkPad on 2017/8/27.
 */
@Component
@Handler(code = "100204",name="个人基本信息修改")
public class PersonInfoModifyHandler extends AbstractMessageHandler {

    @Override
    protected ResponseMessage innerHandler(RequestMessage requestMessage) throws Exception {
        ResponseMessage responseMessage = new ResponseMessage(requestMessage.getId());
        String channelCode = requestMessage.getArgsPropertyStringValue("sysCode");
        String userType = requestMessage.getArgsPropertyStringValue("userType");
        String user = requestMessage.getArgsPropertyStringValue("user");
        String hosId = requestMessage.getArgsPropertyStringValue("hosId");
        String idCard = requestMessage.getArgsPropertyStringValue("idCard");
        String name = requestMessage.getArgsPropertyStringValue("name");
        IPersonAgent personAgent = getCleverClinicContext().getApplicationContext().getBean(IPersonAgent.class);
        Map<String, Object> res = personAgent.modifyInfoByIdCard(user,idCard, name);
        responseMessage = new ResponseMessage(requestMessage.getId());
        responseMessage.setData(res);
        getPropertiesFromInvokerResultMap(responseMessage, res);
        return responseMessage;
    }
}
